-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[java] for loop enhance and using of standard java 11 method writeString for tests #14889
base: trunk
Are you sure you want to change the base?
Conversation
…le. Files. Such calls can be replaced with a call to a Files. readString() or Files. writeString()
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
This pull request includes several changes to improve the code by replacing the
Files.write
method with the more conciseFiles.writeString
method. Additionally, there is a minor refactor to simplify a loop structure.Codebase simplification:
java/src/org/openqa/selenium/grid/jmx/MBean.java
: Refactored a for loop to use enhanced for-loop syntax for better readability.Method replacement:
java/src/org/openqa/selenium/grid/node/docker/DockerSessionFactory.java
: ReplacedFiles.write
withFiles.writeString
to simplify writing string content to files.java/test/org/openqa/selenium/UploadTest.java
: Updated method to useFiles.writeString
for writing string content to temporary files.java/test/org/openqa/selenium/edge/EdgeOptionsTest.java
: Changed file writing method toFiles.writeString
for better readability and simplicity.java/test/org/openqa/selenium/environment/webserver/AppServerTestBase.java
: Simplified file writing by usingFiles.writeString
instead ofFiles.write
.Motivation and Context
I changed the method calls for writing strings to standard ones from Java 11 to include more standard solutions from the language library. I also replaced looping through the collection with an iterator for better code readability.
Types of changes
Checklist
PR Type
enhancement
Description
MBean.java
to use enhanced for-loop syntax for improved readability.Files.write
withFiles.writeString
across multiple files to simplify file writing operations.Changes walkthrough 📝
MBean.java
Refactor for loop to enhanced for-loop syntax
java/src/org/openqa/selenium/grid/jmx/MBean.java
DockerSessionFactory.java
Use Files.writeString for writing strings to files
java/src/org/openqa/selenium/grid/node/docker/DockerSessionFactory.java
Files.write
withFiles.writeString
.UploadTest.java
Simplify file writing with Files.writeString
java/test/org/openqa/selenium/UploadTest.java
Files.writeString
.EdgeOptionsTest.java
Update file writing to Files.writeString
java/test/org/openqa/selenium/edge/EdgeOptionsTest.java
Files.writeString
.AppServerTestBase.java
Use Files.writeString for temporary file creation
java/test/org/openqa/selenium/environment/webserver/AppServerTestBase.java
Files.write
withFiles.writeString
.NodeTest.java
Simplify file writing in NodeTest with Files.writeString
java/test/org/openqa/selenium/grid/node/NodeTest.java
Files.writeString
.ResourceHandlerTest.java
Refactor file operations to use Files.writeString
java/test/org/openqa/selenium/grid/web/ResourceHandlerTest.java
Files.write
withFiles.writeString
in tests.TestUtilities.java
Simplify file writing in TestUtilities
java/test/org/openqa/selenium/testing/TestUtilities.java
Files.writeString
.